Skip to main content

All Questions

3votes
1answer
272views

Array rotation in C++

I am completely new to data structures and algorithms. I tried this problem on hackerank. I got the desired output but my code wasn't efficient enough to execute in the given time limit. How can I ...
Samir's user avatar
2votes
1answer
977views

Count number of previous elements greater than its element at present index

Suppose I have a vector containing n elements. I want to find out the number of previous elements greater than its element at present index i. I want to find ...
sukesh's user avatar
3votes
2answers
475views

2D array inquiries

I am trying to solve a problem as described below: You are given an input of a n*m forest. You have to answer a group of inquiries. Your task is to return the number of trees for every ...
Kurns's user avatar
3votes
4answers
3kviews

Rearranging an array such that positive and negative elements are at alternate positions

We are given an array in which we have equal number of positive and negative elements. We have to rearrange this array such that all positive and negative elements are at alternate positions and ...
sahil mehta's user avatar
2votes
2answers
3kviews

Swift HackerRank Missing Numbers Challenge

I'm attempting to solve the "Missing Numbers" challenge on HackerRank where I'm tasked with finding missing elements comparing two arrays. Foundation's ...
Adrian's user avatar
5votes
1answer
2kviews

C program circular array rotation

I'm trying to solve a Hackerrank problem where you perform karray[n] rotations, and at the end, ask for ...
Gabriel's user avatar
3votes
4answers
5kviews

Circular array rotation Java

I have a solution to the HackerRank Circular Array Rotation challenge. It passes 7 test cases out of 15. The rest of them are getting timed out. I think it's because of the huge data set that has ...
Jude Niroshan's user avatar
1vote
3answers
103views

Finding the nth machine encountered on the journey

Recently I came across this problem in the IARCS server,here is an little excerpt from it, A well-known bandit who used to haunt the forests around Siruseri was eliminated by the policemen a few ...
hellozee's user avatar
0votes
1answer
115views

Recovering permutation from its image sequence

Recently while practicing I came across this problem , here is an excerpt from it, A permutation of the numbers 1, ..., N is a rearrangment of these numbers. For example 2 4 5 1 7 6 3 ...
hellozee's user avatar
7votes
4answers
1kviews

Code for calculating citizens beheaded

Recently I came across this problem , A despotic king decided that his kingdom needed to be rid of corruption and disparity. He called his prime minister and ordered that all corrupt citizens be ...
hellozee's user avatar
3votes
1answer
634views

Painting Tom Sawyer's Fence - programming on Free Pascal

Tom Sawyer has many friends who paints his fence. Each friend painted contiguous part of the fence. Some planks could stay unpainted, some could be painted several times. Program must output the ...
Tanya Serdyukova's user avatar

close